#ifndef __DETU_MEDIA_AVS_CHN_IMP_H__
#define __DETU_MEDIA_AVS_CHN_IMP_H__

#include "avs_chn.h"
#include "mutex.h"

#include "hi_comm_avs.h"


namespace detu_media
{

class AvsGrpImp;

class AvsChnImp: public AvsChn
{

protected:
	AvsChnImp(const AVS_GRP grpId);

	virtual ~AvsChnImp();

	friend class AvsGrpImp;

public:
    virtual S_Result start(void);

    virtual S_Result stop(void);

    virtual bool isStarted(void);

    virtual S_Result getId(int &id);

private:
    S_Result init(const Json::Value& config);

    S_Result deInit(void);

    bool isInited(void);

private:
	constexpr static const AVS_CHN_ATTR_S defaultChnAttr =
	{
		.u32Width = 3840,
		.u32Height = 1920,
		.enCompressMode = COMPRESS_MODE_NONE,//COMPRESS_MODE_SEG,
		.enDynamicRange = DYNAMIC_RANGE_SDR8,
		.u32Depth = 0,
		.stFrameRate =
		{
			.s32SrcFrameRate = -1,
			.s32DstFrameRate = -1
		}
	};

private:
    AVS_CHN			fChnId;
    AVS_GRP			fGrpId;

	AVS_CHN_ATTR_S 	fChnAttr;

	int                         fRef;
    bool                        fInited;
    detu_infra::Mutex           fMutex;
	detu_infra::Mutex           fPauseMutex;
};

}

#endif
